<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv=Cache-Control content=no-cache />
    <title>通通加油--好好学习</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #app h2 {
            width: 500px;
            margin: 0 auto;
            text-align: center;

            margin-bottom: 10px;
        }

        #app button {
            display: block;
            width: 100px;
            margin: 0 auto;
            margin-bottom: 20px;
        }

        .qlist {
            list-style: none;
            width: 100%;
            margin: 0 auto;
            overflow: hidden;
        }

        .qlist li {
            float: left;
            width: 100%;
            margin-bottom: 6px;
            padding-left: 20px;
        }
    </style>
</head>

<body>
    <div id="app">
        <h2>通通加油哦---题目选择</h2>
        <ul class="qlist">
            <li v-for="(item,index) in exams" :index="index">
                <a :href="item.url">{{index+1}})、 {{item.casename}}</a>
            </li>
        </ul>
    </div>

</body>
<script src="./vue.min.js"></script>
<script>

    function makeOneQuestion() {
        var result = "";
        var mResult = "";
        var num1 = Math.ceil(Math.random() * 99);
        var num2 = Math.ceil(Math.random() * 99);
        var num3 = Math.ceil(Math.random() * 99);
        var oper1 = Math.round(Math.random()) == 1 ? "+" : "-";
        var oper2 = Math.round(Math.random()) == 1 ? "+" : "-";
        var isBlank = Math.round(Math.random());

        if (isBlank == 1) {
            mResult = num2 + oper2 + num3;

            if (eval(mResult) < 0 || eval(mResult) > 100) {
                result = "";
            } else {
                result = num1 + oper1 + "(" + num2 + oper2 + num3 + ")";
                if (eval(result) < 0) {
                    result = "";
                }
            }
        } else {
            mResult = num1 + oper1 + num2;
            if (eval(mResult) < 0 || eval(mResult) > 100) {
                result = "";
            } else {
                result = num1 + oper1 + num2 + oper2 + num3;
                if (eval(result) < 0) {
                    result = "";
                }
            }

        }
        return result;
    }

    new Vue({
        el: '#app',
        data: {
            exams: [
                { "casename": "三个数100内加减法带括号--练习竖式", "url": "exam1.html" },
                { "casename": "口算10以内加减乘运算", "url": "exam2.html" },
                { "casename": "口算10以内乘法", "url": "exam3.html" },
                { "casename": "1000以内加减法---生成器", "url": "exam4.html" },
                { "casename": "两位数乘法---生成器", "url": "exam5.html" }
            ]
        },
        methods: {

        },
        ready: function () {

        }
    })

</script>

</html>